package designpattern.adapter.third;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 刘牌
 * @Date: 2021/12/20/14:36
 * @Description:
 */
public class AuthServiceImpl implements IAuthService{
    @Override
    public String login(String username, String password) {
        return check(username, password);
    }

    @Override
    public String register(String username, String password) {
        return "注册成功";
    }

    String check(String username , String password){
        UserInfo userInfo = queryUserInfo(username);
        if (userInfo.getUsername() != null && userInfo.getPassword().equals(password)){
            return "登录成功";
        }
        return "登录失败";
    }

    UserInfo queryUserInfo(String username){
        return new UserInfo("xiaosi","123456");
    }

}
